package com.xmuexp.e09.model;

import lombok.Data;


@Data
public class ProductRetVo {
    Integer id;
    String name;
    String skuSn;
    String detail;
    String imageUrl;
    Integer originalPrice;
    Integer price;
    Integer inventory;
    Integer state;
    Integer weight;
    String gmtCreate;
    String gmtModified;
    GoodsRetVo goods;
    Boolean disabled;
    Boolean shareable;

    public ProductRetVo(Product product){
        this.id=product.getId();
        this.name=product.getName();
        this.skuSn=product.getProductSn();
        this.detail=product.getDetail();
        this.imageUrl=product.getImageUrl();
        this.originalPrice=product.getOriginalPrice();

        this.price=null;
        this.inventory=null;

        this.state=product.getState();
        this.weight=product.getWeight();
        this.gmtCreate=product.getGmtCreate().toString();
        this.gmtModified=product.getGmtModified().toString();
        this.goods= new GoodsRetVo(product.getGoods());
        this.disabled= product.getDisabled()==1;
        this.shareable= product.getShareable()==1;
    }
}
